﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.IO;

namespace FergusonMoriyama.Umbraco
{

    class PageRequester
    {
        protected String content;
        protected String error;
        
        public String Error
        {
            get
            {
               return error;
            }
        }


        public String Content
        {
            get
            {
               return content;
            }
        }

        public PageRequester()
        {
           
        }

        public bool getPage(String url)
        {
            try
            {

                WebRequest request = WebRequest.Create(url);
                WebResponse response = request.GetResponse();
                StreamReader reader = new StreamReader(response.GetResponseStream());
                content = reader.ReadToEnd();
                return true;
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return false;
            }
           
        }

    }
}
